package org.wkg.lesson02;

public class Demo_201 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(()->{
            while (true) {
                try {
                    Thread.sleep(10);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println(Thread.currentThread().getName()+ "  Thread 执行....");
            }
        },"Thread执行程序");
        thread.start();
        System.out.println(thread.getName() + " :isAlive: " + thread.isAlive());
        Thread.sleep(1000);
        thread.interrupt();
        Thread.sleep(100);
        System.out.println(thread.getName() + " :isAlive: " + thread.isAlive());

    }
}
